{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import yaml\n",
    "import json\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "path = '../stories/all_stories.yml'\n",
    "with open(path, 'r', encoding='utf-8') as f:\n",
    "    story = yaml.load(f.read(),Loader=yaml.Loader)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'steps': [{'entities': [{'operation': '打开'}, {'device': '抽油烟机'}],\n",
       "    'intent': 'Control-RangHood_State'},\n",
       "   {'action': 'Control-RangHood_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '抽油烟机'},\n",
       "     {'mode': '强力模式'}],\n",
       "    'intent': 'Control-RangHood_State'},\n",
       "   {'action': 'Control-RangHood_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'},\n",
       "     {'address': '主卧'},\n",
       "     {'operation': '打开'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'device': '灯'}, {'address': '客厅'}], 'intent': 'inform_Lamp'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'address': '客厅'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'range': '所有'}], 'intent': 'inform_range'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'range': '所有'},\n",
       "     {'device': '灯'},\n",
       "     {'operation': '打开'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '开'}, {'device': '灯'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'device': '灯'}, {'address': '客厅'}], 'intent': 'inform_Lamp'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '开'}, {'device': '灯'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'address': '客厅'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'},\n",
       "     {'address': '餐厅'},\n",
       "     {'operation': '关闭'}],\n",
       "    'intent': 'Control-Lamp_Close'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'operation': '关闭'}],\n",
       "    'intent': 'Control-Lamp_Close'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'device': '灯'}, {'address': '餐厅'}], 'intent': 'inform_Lamp'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'operation': '关闭'}],\n",
       "    'intent': 'Control-Lamp_Close'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'range': '所有'}], 'intent': 'inform_range'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'},\n",
       "     {'range': '所有'},\n",
       "     {'operation': '关闭'}],\n",
       "    'intent': 'Control-Lamp_Close'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '关'}, {'device': '灯'}],\n",
       "    'intent': 'Control-Lamp_Close'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'device': '灯'}, {'address': '餐厅'}], 'intent': 'inform_Lamp'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '关'}, {'device': '灯'}],\n",
       "    'intent': 'Control-Lamp_Close'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'range': '所有'}], 'intent': 'inform_range'},\n",
       "   {'action': 'Control-Lamp_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'}, {'device': '灯'}],\n",
       "    'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '调低'}, {'device': '灯'}],\n",
       "    'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'},\n",
       "   {'entities': [{'address': '客厅'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '调低'}, {'device': '灯光'}],\n",
       "    'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'},\n",
       "     {'device': '灯'},\n",
       "     {'address': '客厅'}],\n",
       "    'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'sensorvalue': '最大亮度'},\n",
       "     {'device': '灯'},\n",
       "     {'address': '客厅'}],\n",
       "    'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '灯`'},\n",
       "     {'address': '主卧'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'sensorvalue': '最大亮度'}], 'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'},\n",
       "   {'entities': [{'sensorvalue': '最低亮度'}], 'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '台灯'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'device': '台灯'}, {'operation': '调亮'}],\n",
       "    'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '灯'},\n",
       "     {'address': '厕所'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'sensorvalue': '最低亮度'}], 'intent': 'inform_sensorvalue'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '灯'},\n",
       "     {'address': '主卧'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'sensorvalue': '最大亮度'}], 'intent': 'inform_sensorvalue'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '灯'},\n",
       "     {'address': '厨房'}],\n",
       "    'intent': 'Control-Lamp_Open'},\n",
       "   {'action': 'Control-Lamp_State'},\n",
       "   {'entities': [{'sensorvalue': '最大亮度'}], 'intent': 'Control-Lamp_Lightness'},\n",
       "   {'action': 'Control-Lamp_Lightness'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'},\n",
       "     {'address': '客厅'},\n",
       "     {'mode': '明亮模式'}],\n",
       "    'intent': 'Control-Lamp_Mode'},\n",
       "   {'action': 'Control-Lamp_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'color': '冷色'}, {'address': '客厅'}],\n",
       "    'intent': 'Control-Lamp_Color'},\n",
       "   {'action': 'Control-Lamp_Color'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'},\n",
       "     {'mode': '温馨模式'},\n",
       "     {'address': '客厅'}],\n",
       "    'intent': 'Control-Lamp_Mode'},\n",
       "   {'action': 'Control-Lamp_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'address': '客厅'}, {'color': '红色'}],\n",
       "    'intent': 'Control-Lamp_Color'},\n",
       "   {'action': 'Control-Lamp_Color'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'},\n",
       "     {'address': '客厅'},\n",
       "     {'mode': '明亮模式'}],\n",
       "    'intent': 'Control-Lamp_Mode'},\n",
       "   {'action': 'Control-Lamp_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'address': '客厅'}, {'color': '暖色'}],\n",
       "    'intent': 'Control-Lamp_Color'},\n",
       "   {'action': 'Control-Lamp_Color'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}, {'mode': '明亮模式'}],\n",
       "    'intent': 'Control-Lamp_Mode'},\n",
       "   {'action': 'Control-Lamp_Mode'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'}], 'intent': 'Control-Lamp_Color'},\n",
       "   {'action': 'Control-Lamp_Color', 'entities': [{'color': '暖色'}]},\n",
       "   {'entities': [{'address': '客卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_Color'}]},\n",
       " {'steps': [{'entities': [{'device': '灯'},\n",
       "     {'address': '客厅'},\n",
       "     {'target': '颜色'},\n",
       "     {'operation': '调整'},\n",
       "     {'color': '红色'}],\n",
       "    'intent': 'Control-Lamp_Color'},\n",
       "   {'action': 'Control-Lamp_Color'},\n",
       "   {'entities': [{'operation': '切换'}, {'target': '色调'}, {'color': '暖色'}],\n",
       "    'intent': 'Control-Lamp_Color'},\n",
       "   {'action': 'Control-Lamp_Color'}]},\n",
       " {'steps': [{'entities': [{'time': '一小时'},\n",
       "     {'operation': '打开'},\n",
       "     {'device': '灯'},\n",
       "     {'address': '主卧'}],\n",
       "    'intent': 'Control-Lamp_Timing'},\n",
       "   {'action': 'Control-Lamp_Timing'}]},\n",
       " {'steps': [{'entities': [{'operation': '关闭'},\n",
       "     {'device': '灯'},\n",
       "     {'address': '客厅'},\n",
       "     {'time': '两小时'}],\n",
       "    'intent': 'Control-Lamp_Timing'},\n",
       "   {'action': 'Control-Lamp_Timing'}]},\n",
       " {'steps': [{'entities': [{'time': '一小时'},\n",
       "     {'operation': '关闭'},\n",
       "     {'device': '灯'}],\n",
       "    'intent': 'Control-Lamp_Timing'},\n",
       "   {'action': 'Control-Lamp_Timing'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Lamp_Timing'}]},\n",
       " {'steps': [{'entities': [{'device': '风扇'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-Fan_State'},\n",
       "   {'action': 'Control-Fan_State'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'Control-Fan_State'},\n",
       "   {'action': 'Control-Fan_State'}]},\n",
       " {'steps': [{'entities': [{'device': '风扇'},\n",
       "     {'operation': '打开'},\n",
       "     {'address': '主卧'}],\n",
       "    'intent': 'Control-Fan_State'},\n",
       "   {'action': 'Control-Fan_State'}]},\n",
       " {'steps': [{'entities': [{'device': '风扇'}, {'operation': '关闭'}],\n",
       "    'intent': 'Control-Fan_State'},\n",
       "   {'action': 'Control-Fan_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '增大风速'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_Wind'},\n",
       "   {'action': 'Control-Fan_Wind'}]},\n",
       " {'steps': [{'entities': [{'sensorvalue': '最大风速'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_Wind'},\n",
       "   {'action': 'Control-Fan_Wind'}]},\n",
       " {'steps': [{'entities': [{'sensorvalue': '中等风速'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_Wind'},\n",
       "   {'action': 'Control-Fan_Wind'}]},\n",
       " {'steps': [{'entities': [{'sensorvalue': '三档'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_Gear'},\n",
       "   {'action': 'Control-Fan_Gear'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_Gear'},\n",
       "   {'action': 'Control-Fan_Gear'}]},\n",
       " {'steps': [{'entities': [{'mode': '左右扫风'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_Mode'},\n",
       "   {'action': 'Control-Fan_Mode'}]},\n",
       " {'steps': [{'entities': [{'mode': '左右扫风'},\n",
       "     {'device': '风扇'},\n",
       "     {'operation': '关闭'}],\n",
       "    'intent': 'Control-Fan_Mode'},\n",
       "   {'action': 'Control-Fan_Mode'}]},\n",
       " {'steps': [{'entities': [{'time': '一小时'},\n",
       "     {'operation': '关闭'},\n",
       "     {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_Timing'},\n",
       "   {'action': 'Control-Fan_Timing'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_State'},\n",
       "   {'action': 'Control-Fan_State'},\n",
       "   {'entities': [{'time': '一小时'}], 'intent': 'Control-Fan_Timing'},\n",
       "   {'action': 'Control-Fan_Timing'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_State'},\n",
       "   {'action': 'Control-Fan_State'},\n",
       "   {'entities': [{'time': '一小时'}], 'intent': 'Control-Fan_Timing'},\n",
       "   {'action': 'Control-Fan_Timing'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '加湿器'}],\n",
       "    'intent': 'Control-Humidifier_State'},\n",
       "   {'action': 'Control-Humidifier_State'}]},\n",
       " {'steps': [{'entities': [{'gear_level': '三档'}, {'device': '加湿器'}],\n",
       "    'intent': 'Control-Humidifier_Gear'},\n",
       "   {'action': 'Control-Humidifier_Gear'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'}, {'device': '加湿器'}],\n",
       "    'intent': 'Control-Humidifier_Gear'},\n",
       "   {'action': 'Control-Humidifier_Gear'}]},\n",
       " {'steps': [{'entities': [{'device': '加湿器'},\n",
       "     {'time': '一个小时'},\n",
       "     {'operation': '关闭'}],\n",
       "    'intent': 'Control-Humidifier_Timing'},\n",
       "   {'action': 'action_humidifiertiming'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '电饭煲'}],\n",
       "    'intent': 'Control-RiceCooker_State'},\n",
       "   {'action': 'Control-RiceCooker_State'},\n",
       "   {'entities': [{'device': '电饭煲'}, {'mode': '煲汤模式'}],\n",
       "    'intent': 'Control-RiceCooker_Mode'},\n",
       "   {'action': 'Control-RiceCooker_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '电饭煲'}, {'mode': '煲汤模式'}],\n",
       "    'intent': 'Control-RiceCooker_Mode'},\n",
       "   {'action': 'Control-RiceCooker_Mode'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '电饭煲'}],\n",
       "    'intent': 'Control-RiceCooker_State'},\n",
       "   {'action': 'Control-RiceCooker_State'},\n",
       "   {'entities': [{'device': '电饭煲'}, {'time': '一个小时'}],\n",
       "    'intent': 'Control-RiceCooker_Timing'},\n",
       "   {'action': 'Control-RiceCooker_Timing'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'},\n",
       "     {'operation': '打开'},\n",
       "     {'sensorvalue': '一半'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'}, {'operation': '关闭'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'},\n",
       "     {'operation': '关闭'},\n",
       "     {'sensorvalue': '一半'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'},\n",
       "     {'operation': '关闭'},\n",
       "     {'address': '书房'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'},\n",
       "     {'operation': '关闭'},\n",
       "     {'address': '书房'},\n",
       "     {'sensorvalue': '一半'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'},\n",
       "     {'date_time': '明天早上'},\n",
       "     {'time': '七点半'},\n",
       "     {'operation': '打开'}],\n",
       "    'intent': 'Control-Curtain_Timing'},\n",
       "   {'action': 'Control-Curtain_Timing'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'},\n",
       "     {'date_time': '明天早上'},\n",
       "     {'time': '七点半'},\n",
       "     {'operation': '打开'},\n",
       "     {'sensorvalue': '一半'}],\n",
       "    'intent': 'Control-Curtain_Timing'},\n",
       "   {'action': 'Control-Curtain_Timing'}]},\n",
       " {'steps': [{'entities': [{'device': '烤箱'}, {'operation': '启动'}],\n",
       "    'intent': 'Control-Oven_State'},\n",
       "   {'action': 'Control-Oven_State'}]},\n",
       " {'steps': [{'entities': [{'device': '烤箱'}, {'operation': '关闭'}],\n",
       "    'intent': 'Control-Oven_State'},\n",
       "   {'action': 'Control-Oven_State'}]},\n",
       " {'steps': [{'entities': [{'mode': '烤鸡模式'}, {'device': '烤箱'}],\n",
       "    'intent': 'Control-Oven_Mode'},\n",
       "   {'action': 'Control-Oven_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '烤箱'}, {'temperature': '一百八十度'}],\n",
       "    'intent': 'Control-Oven_Temp'},\n",
       "   {'action': 'Control-Oven_Temp'}]},\n",
       " {'steps': [{'entities': [{'address': '主卧'},\n",
       "     {'device': '空调'},\n",
       "     {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '客厅'}, {'device': '空调'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '客厅'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'range': '所有'}], 'intent': 'inform_range'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'range': '所有'},\n",
       "     {'device': '空调'},\n",
       "     {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'device': '空调'}, {'address': '客厅'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '客厅'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'address': '客厅'},\n",
       "     {'device': '空调'},\n",
       "     {'operation': '关闭'}],\n",
       "    'intent': 'Control-AC_Close'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'}, {'operation': '关闭'}],\n",
       "    'intent': 'Control-AC_Close'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '客厅'}, {'device': '空调'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'range': '所有'},\n",
       "     {'device': '空调'},\n",
       "     {'operation': '关闭'}],\n",
       "    'intent': 'Control-AC_Close'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '关闭'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Close'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'device': '空调'}, {'address': '书房'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '关闭'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Close'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'operation': '关闭'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Close'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'range': '所有'}], 'intent': 'inform_range'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'address': '客厅'},\n",
       "     {'device': '空调'},\n",
       "     {'mode': '制热模式'}],\n",
       "    'intent': 'Control-AC_Mode'},\n",
       "   {'action': 'Control-AC_Mode'}]},\n",
       " {'steps': [{'entities': [{'mode': '节能模式'}], 'intent': 'Control-AC_Mode'},\n",
       "   {'action': 'Control-AC_Mode'},\n",
       "   {'entities': [{'address': '客厅'}, {'device': '空调'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'}, {'mode': '节能模式'}],\n",
       "    'intent': 'Control-AC_Mode'},\n",
       "   {'action': 'Control-AC_Mode'},\n",
       "   {'entities': [{'address': '主卧'}, {'device': '空调'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_Mode'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '空调'},\n",
       "     {'address': '书房'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'mode': '节能模式'}], 'intent': 'Control-AC_Mode'},\n",
       "   {'action': 'Control-AC_Mode'},\n",
       "   {'entities': [{'mode': '左右扫风'}], 'intent': 'Control-AC_Mode'},\n",
       "   {'action': 'Control-AC_Mode'}]},\n",
       " {'steps': [{'entities': [{'time': '一小时'},\n",
       "     {'operation': '关闭'},\n",
       "     {'device': '空调'},\n",
       "     {'address': '主卧'}],\n",
       "    'intent': 'Control-AC_Timing'},\n",
       "   {'action': 'Control-AC_Timing'}]},\n",
       " {'steps': [{'entities': [{'time': '一小时'},\n",
       "     {'operation': '关闭'},\n",
       "     {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Timing'},\n",
       "   {'action': 'Control-AC_Timing'},\n",
       "   {'entities': [{'device': '空调'}, {'address': '主卧'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_Timing'}]},\n",
       " {'steps': [{'entities': [{'time': '一小时'},\n",
       "     {'operation': '关闭'},\n",
       "     {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Timing'},\n",
       "   {'action': 'Control-AC_Timing'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_Timing'}]},\n",
       " {'steps': [{'intent': 'Control-AC_Timing'},\n",
       "   {'action': 'Control-AC_Timing'},\n",
       "   {'entities': [{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Timing'},\n",
       "   {'action': 'Control-AC_Timing'},\n",
       "   {'entities': [{'device': '空调'}, {'address': '主卧'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_Timing'}]},\n",
       " {'steps': [{'entities': [{'time': '五小时'},\n",
       "     {'operation': '关闭'},\n",
       "     {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Timing'},\n",
       "   {'action': 'Control-AC_Timing'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_Timing'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'time': '一小时'}, {'operation': '关闭'}],\n",
       "    'intent': 'Control-AC_Timing'},\n",
       "   {'action': 'Control-AC_Timing'}]},\n",
       " {'steps': [{'entities': [{'operation': '增大'},\n",
       "     {'target': '风速'},\n",
       "     {'device': '空调'},\n",
       "     {'address': '客厅'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'sensorvalue': '最大'},\n",
       "     {'target': '风速'},\n",
       "     {'device': '空调'},\n",
       "     {'address': '客厅'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'},\n",
       "     {'target': '风速'},\n",
       "     {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'},\n",
       "     {'device': '空调'},\n",
       "     {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'},\n",
       "     {'device': '空调'},\n",
       "     {'address': '主卧'},\n",
       "     {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '调高'},\n",
       "     {'device': '空调'},\n",
       "     {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'},\n",
       "   {'entities': [{'device': '空调'}, {'address': '主卧'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '空调'},\n",
       "     {'address': '主卧'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'sensorvalue': '最大'}, {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'},\n",
       "   {'entities': [{'sensorvalue': '最小'}, {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'sensorvalue': '最大'}, {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'},\n",
       "   {'entities': [{'sensorvalue': '最小'}, {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'},\n",
       "     {'device': '空调'},\n",
       "     {'address': '书房'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'device': '空调'},\n",
       "     {'address': '书房'},\n",
       "     {'operation': '增大'},\n",
       "     {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '书房'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'device': '空调'},\n",
       "     {'address': '书房'},\n",
       "     {'operation': '增大'},\n",
       "     {'target': '风速'}],\n",
       "    'intent': 'Control-AC_Wind'},\n",
       "   {'action': 'Control-AC_Wind'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'},\n",
       "     {'address': '主卧'},\n",
       "     {'operation': '调高到'},\n",
       "     {'temperature': '二十度'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'address': '客厅'},\n",
       "     {'device': '空调'},\n",
       "     {'operation': '调高'},\n",
       "     {'temperature': '一度'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'},\n",
       "     {'address': '主卧'},\n",
       "     {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'device': '空调'},\n",
       "     {'operation': '调高到'},\n",
       "     {'temperature': '二十五度'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'},\n",
       "   {'entities': [{'device': '空调'}, {'operation': '调高'}, {'temperature': '两度'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'},\n",
       "   {'entities': [{'operation': '关闭'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Close'},\n",
       "   {'action': 'Control-AC_State'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'},\n",
       "     {'operation': '调高到'},\n",
       "     {'temperature': '二十五度'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'},\n",
       "   {'entities': [{'device': '空调'}, {'address': '主卧'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'},\n",
       "     {'operation': '调高到'},\n",
       "     {'temperature': '二十五度'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '主卧'}, {'device': '空调'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'temperature': '二十五度'}, {'target': '温度'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '空调'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '客厅'}], 'intent': 'inform_AC'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'target': '温度'}, {'operation': '调高'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'},\n",
       "     {'target': '温度'},\n",
       "     {'operation': '调高'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '窗帘'},\n",
       "     {'operation': '打开'},\n",
       "     {'address': '主卧'}],\n",
       "    'intent': 'Control-Curtain_State'},\n",
       "   {'action': 'Control-Curtain_State'}]},\n",
       " {'steps': [{'entities': [{'device': '电饭煲'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-RiceCooker_State'},\n",
       "   {'action': 'Control-RiceCooker_State'},\n",
       "   {'entities': [{'mode': '煮饭模式'}], 'intent': 'Control-RiceCooker_Mode'},\n",
       "   {'action': 'Control-RiceCooker_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'address': '主卧'}], 'intent': 'inform_address'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'mode': '制冷模式'}], 'intent': 'inform_mode'},\n",
       "   {'action': 'Control-AC_Mode'}]},\n",
       " {'steps': [{'entities': [{'device': '烤箱'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-Oven_State'},\n",
       "   {'action': 'Control-Oven_State'},\n",
       "   {'entities': [{'mode': '烤鸡模式'}], 'intent': 'Control-Oven_Mode'},\n",
       "   {'action': 'Control-Oven_Mode'},\n",
       "   {'entities': [{'device': '烤箱'},\n",
       "     {'operation': '调到'},\n",
       "     {'temperature': '两百度'}],\n",
       "    'intent': 'Control-Oven_Temp'},\n",
       "   {'action': 'Control-Oven_Temp'}]},\n",
       " {'steps': [{'entities': [{'device': '空调'}, {'operation': '打开'}],\n",
       "    'intent': 'Control-AC_Open'},\n",
       "   {'action': 'Control-AC_State'},\n",
       "   {'entities': [{'temperature': '二十九'},\n",
       "     {'device': '空调'},\n",
       "     {'operation': '调到'}],\n",
       "    'intent': 'Control-AC_Temp'},\n",
       "   {'action': 'Control-AC_Temp'}]},\n",
       " {'steps': [{'entities': [{'operation': '打开'}, {'device': '风扇'}],\n",
       "    'intent': 'Control-Fan_State'},\n",
       "   {'action': 'Control-Fan_State'},\n",
       "   {'entities': [{'mode': '左右摇头'}], 'intent': 'Control-Fan_Mode'},\n",
       "   {'action': 'Control-Fan_Mode'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'greet'},\n",
       "   {'action': 'utter_answer_greet'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'greet'},\n",
       "   {'action': 'utter_answer_greet'},\n",
       "   {'entities': None, 'intent': 'affirm'},\n",
       "   {'action': 'utter_answer_affirm'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'greet'},\n",
       "   {'action': 'utter_answer_greet'},\n",
       "   {'entities': None, 'intent': 'deny'},\n",
       "   {'action': 'utter_answer_deny'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'deny'},\n",
       "   {'action': 'utter_answer_deny'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'goodbye'},\n",
       "   {'action': 'utter_answer_goodbye'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'greet'},\n",
       "   {'action': 'utter_answer_greet'},\n",
       "   {'entities': None, 'intent': 'thanks'},\n",
       "   {'action': 'utter_answer_thanks'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'thanks'},\n",
       "   {'action': 'utter_answer_thanks'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'greet'},\n",
       "   {'action': 'utter_answer_greet'},\n",
       "   {'entities': None, 'intent': 'whoareyou'},\n",
       "   {'action': 'utter_answer_whoareyou'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'whoareyou'},\n",
       "   {'action': 'utter_answer_whoareyou'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'greet'},\n",
       "   {'action': 'utter_answer_greet'},\n",
       "   {'entities': None, 'intent': 'whoareyou'},\n",
       "   {'action': 'utter_answer_whoareyou'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'whattodo'},\n",
       "   {'action': 'utter_answer_whattodo'}]},\n",
       " {'steps': [{'entities': None, 'intent': 'greet'},\n",
       "   {'action': 'utter_answer_greet'},\n",
       "   {'entities': None, 'intent': 'whattodo'},\n",
       "   {'action': 'utter_answer_whattodo'}]}]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "story"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def construct_story_map(dataset):\n",
    "    # 由story构建story_map, 根据intent和slot值在story中进行查找来判断action\n",
    "    story_map = []\n",
    "    story_listmap = []\n",
    "    target = 0 \n",
    "    for val in dataset:\n",
    "        data = val['steps']\n",
    "        for index in range(0, len(data), 2):\n",
    "            slots = []\n",
    "            user_intent = []\n",
    "            \n",
    "            # 当前状态\n",
    "            current_intent  =  data[index]['intent']\n",
    "            if 'entities' in data[index].keys():\n",
    "                current_slot = data[index]['entities']\n",
    "            else:\n",
    "                current_slot = []\n",
    "            current_action = [data[index+1]['action']]\n",
    "            \n",
    "            \n",
    "            # 历史状态\n",
    "            pre_intent = []\n",
    "            pre_slot = []\n",
    "            pre_action = []\n",
    "            \n",
    "            pre_history_1 = index-2\n",
    "            if pre_history_1 >= 0:\n",
    "                pre_intent = data[pre_history_1]['intent']\n",
    "                if 'entities' in data[pre_history_1].keys():\n",
    "                    pre_slot = data[pre_history_1]['entities']\n",
    "                    \n",
    "            if pre_action == []:\n",
    "                pre_action = ['PAD']\n",
    "            \n",
    "            slots_sum = [current_slot, pre_slot]\n",
    "            \n",
    "            for i in slots_sum:\n",
    "                if i  != [] and i is not None:\n",
    "                    for val in i:\n",
    "                        for key, j in val.items():\n",
    "                            if key not in slots:\n",
    "                                slots.append((key))\n",
    "            if slots == []:\n",
    "                slots = ['PAD']\n",
    "                \n",
    "            \n",
    "            user_intent_sum = [current_intent, pre_intent]\n",
    "            for i in user_intent_sum:\n",
    "                if i != []:\n",
    "                    user_intent.append(i)\n",
    "            if user_intent == []:\n",
    "                user_intent = ['PAD']\n",
    "            \n",
    "            story_name = \"story\"+str(target)\n",
    "            if {'storys':[slots,user_intent],'action':current_action} in story_map:\n",
    "                pass\n",
    "            else:\n",
    "                story_map.append({'storys':[slots,user_intent],'action':current_action})\n",
    "            story_listmap.append([user_intent,slots,current_action])\n",
    "    return story_map, story_listmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[{'operation': '打开'}, {'device': '抽油烟机'}], []]\n",
      "[[{'operation': '打开'}, {'device': '抽油烟机'}, {'mode': '强力模式'}], []]\n",
      "[[{'device': '灯'}, {'address': '主卧'}, {'operation': '打开'}], []]\n",
      "[[{'device': '灯'}, {'operation': '打开'}], []]\n",
      "[[{'device': '灯'}, {'address': '客厅'}], [{'device': '灯'}, {'operation': '打开'}]]\n",
      "[[{'device': '灯'}, {'operation': '打开'}], []]\n",
      "[[{'address': '客厅'}], [{'device': '灯'}, {'operation': '打开'}]]\n",
      "[[{'device': '灯'}, {'operation': '打开'}], []]\n",
      "[[{'range': '所有'}], [{'device': '灯'}, {'operation': '打开'}]]\n",
      "[[{'range': '所有'}, {'device': '灯'}, {'operation': '打开'}], []]\n",
      "[[{'operation': '开'}, {'device': '灯'}], []]\n",
      "[[{'device': '灯'}, {'address': '客厅'}], [{'operation': '开'}, {'device': '灯'}]]\n",
      "[[{'operation': '开'}, {'device': '灯'}], []]\n",
      "[[{'address': '客厅'}], [{'operation': '开'}, {'device': '灯'}]]\n",
      "[[{'device': '灯'}, {'address': '餐厅'}, {'operation': '关闭'}], []]\n",
      "[[{'device': '灯'}, {'operation': '关闭'}], []]\n",
      "[[{'device': '灯'}, {'address': '餐厅'}], [{'device': '灯'}, {'operation': '关闭'}]]\n",
      "[[{'device': '灯'}, {'operation': '关闭'}], []]\n",
      "[[{'range': '所有'}], [{'device': '灯'}, {'operation': '关闭'}]]\n",
      "[[{'device': '灯'}, {'range': '所有'}, {'operation': '关闭'}], []]\n",
      "[[{'operation': '关'}, {'device': '灯'}], []]\n",
      "[[{'device': '灯'}, {'address': '餐厅'}], [{'operation': '关'}, {'device': '灯'}]]\n",
      "[[{'operation': '关'}, {'device': '灯'}], []]\n",
      "[[{'range': '所有'}], [{'operation': '关'}, {'device': '灯'}]]\n",
      "[[{'operation': '调高'}, {'device': '灯'}], []]\n",
      "[[{'address': '主卧'}], [{'operation': '调高'}, {'device': '灯'}]]\n",
      "[[{'operation': '调低'}, {'device': '灯'}], []]\n",
      "[[{'address': '客厅'}], [{'operation': '调低'}, {'device': '灯'}]]\n",
      "[[{'operation': '调低'}, {'device': '灯光'}], []]\n",
      "[[{'address': '主卧'}], [{'operation': '调低'}, {'device': '灯光'}]]\n",
      "[[{'operation': '调高'}, {'device': '灯'}, {'address': '客厅'}], []]\n",
      "[[{'sensorvalue': '最大亮度'}, {'device': '灯'}, {'address': '客厅'}], []]\n",
      "[[{'operation': '打开'}, {'device': '灯`'}, {'address': '主卧'}], []]\n",
      "[[{'sensorvalue': '最大亮度'}], [{'operation': '打开'}, {'device': '灯`'}, {'address': '主卧'}]]\n",
      "[[{'sensorvalue': '最低亮度'}], [{'sensorvalue': '最大亮度'}]]\n",
      "[[{'operation': '打开'}, {'device': '台灯'}], []]\n",
      "[[{'device': '台灯'}, {'operation': '调亮'}], [{'operation': '打开'}, {'device': '台灯'}]]\n",
      "[[{'operation': '打开'}, {'device': '灯'}, {'address': '厕所'}], []]\n",
      "[[{'sensorvalue': '最低亮度'}], [{'operation': '打开'}, {'device': '灯'}, {'address': '厕所'}]]\n",
      "[[{'operation': '打开'}, {'device': '灯'}, {'address': '主卧'}], []]\n",
      "[[{'sensorvalue': '最大亮度'}], [{'operation': '打开'}, {'device': '灯'}, {'address': '主卧'}]]\n",
      "[[{'operation': '打开'}, {'device': '灯'}, {'address': '厨房'}], []]\n",
      "[[{'sensorvalue': '最大亮度'}], [{'operation': '打开'}, {'device': '灯'}, {'address': '厨房'}]]\n",
      "[[{'device': '灯'}, {'address': '客厅'}, {'mode': '明亮模式'}], []]\n",
      "[[{'device': '灯'}, {'color': '冷色'}, {'address': '客厅'}], []]\n",
      "[[{'device': '灯'}, {'mode': '温馨模式'}, {'address': '客厅'}], []]\n",
      "[[{'device': '灯'}, {'address': '客厅'}, {'color': '红色'}], []]\n",
      "[[{'device': '灯'}, {'address': '客厅'}, {'mode': '明亮模式'}], []]\n",
      "[[{'device': '灯'}, {'address': '客厅'}, {'color': '暖色'}], []]\n",
      "[[{'device': '灯'}, {'mode': '明亮模式'}], []]\n",
      "[[{'address': '主卧'}], [{'device': '灯'}, {'mode': '明亮模式'}]]\n",
      "[[{'device': '灯'}], []]\n",
      "[[{'address': '客卧'}], [{'device': '灯'}]]\n",
      "[[{'device': '灯'}, {'address': '客厅'}, {'target': '颜色'}, {'operation': '调整'}, {'color': '红色'}], []]\n",
      "[[{'operation': '切换'}, {'target': '色调'}, {'color': '暖色'}], [{'device': '灯'}, {'address': '客厅'}, {'target': '颜色'}, {'operation': '调整'}, {'color': '红色'}]]\n",
      "[[{'time': '一小时'}, {'operation': '打开'}, {'device': '灯'}, {'address': '主卧'}], []]\n",
      "[[{'operation': '关闭'}, {'device': '灯'}, {'address': '客厅'}, {'time': '两小时'}], []]\n",
      "[[{'time': '一小时'}, {'operation': '关闭'}, {'device': '灯'}], []]\n",
      "[[{'address': '主卧'}], [{'time': '一小时'}, {'operation': '关闭'}, {'device': '灯'}]]\n",
      "[[{'device': '风扇'}, {'operation': '打开'}], []]\n",
      "[[{'address': '主卧'}], [{'device': '风扇'}, {'operation': '打开'}]]\n",
      "[[{'device': '风扇'}, {'operation': '打开'}, {'address': '主卧'}], []]\n",
      "[[{'device': '风扇'}, {'operation': '关闭'}], []]\n",
      "[[{'operation': '增大风速'}, {'device': '风扇'}], []]\n",
      "[[{'sensorvalue': '最大风速'}, {'device': '风扇'}], []]\n",
      "[[{'sensorvalue': '中等风速'}, {'device': '风扇'}], []]\n",
      "[[{'sensorvalue': '三档'}, {'device': '风扇'}], []]\n",
      "[[{'operation': '调高'}, {'device': '风扇'}], []]\n",
      "[[{'mode': '左右扫风'}, {'device': '风扇'}], []]\n",
      "[[{'mode': '左右扫风'}, {'device': '风扇'}, {'operation': '关闭'}], []]\n",
      "[[{'time': '一小时'}, {'operation': '关闭'}, {'device': '风扇'}], []]\n",
      "[[{'operation': '打开'}, {'device': '风扇'}], []]\n",
      "[[{'time': '一小时'}], [{'operation': '打开'}, {'device': '风扇'}]]\n",
      "[[{'operation': '打开'}, {'device': '风扇'}], []]\n",
      "[[{'time': '一小时'}], [{'operation': '打开'}, {'device': '风扇'}]]\n",
      "[[{'operation': '打开'}, {'device': '加湿器'}], []]\n",
      "[[{'gear_level': '三档'}, {'device': '加湿器'}], []]\n",
      "[[{'operation': '调高'}, {'device': '加湿器'}], []]\n",
      "[[{'device': '加湿器'}, {'time': '一个小时'}, {'operation': '关闭'}], []]\n",
      "[[{'operation': '打开'}, {'device': '电饭煲'}], []]\n",
      "[[{'device': '电饭煲'}, {'mode': '煲汤模式'}], [{'operation': '打开'}, {'device': '电饭煲'}]]\n",
      "[[{'device': '电饭煲'}, {'mode': '煲汤模式'}], []]\n",
      "[[{'operation': '打开'}, {'device': '电饭煲'}], []]\n",
      "[[{'device': '电饭煲'}, {'time': '一个小时'}], [{'operation': '打开'}, {'device': '电饭煲'}]]\n",
      "[[{'device': '窗帘'}, {'operation': '打开'}], []]\n",
      "[[{'device': '窗帘'}, {'operation': '打开'}, {'sensorvalue': '一半'}], []]\n",
      "[[{'device': '窗帘'}, {'operation': '关闭'}], []]\n",
      "[[{'device': '窗帘'}, {'operation': '关闭'}, {'sensorvalue': '一半'}], []]\n",
      "[[{'device': '窗帘'}, {'operation': '关闭'}, {'address': '书房'}], []]\n",
      "[[{'device': '窗帘'}, {'operation': '关闭'}, {'address': '书房'}, {'sensorvalue': '一半'}], []]\n",
      "[[{'device': '窗帘'}, {'date_time': '明天早上'}, {'time': '七点半'}, {'operation': '打开'}], []]\n",
      "[[{'device': '窗帘'}, {'date_time': '明天早上'}, {'time': '七点半'}, {'operation': '打开'}, {'sensorvalue': '一半'}], []]\n",
      "[[{'device': '烤箱'}, {'operation': '启动'}], []]\n",
      "[[{'device': '烤箱'}, {'operation': '关闭'}], []]\n",
      "[[{'mode': '烤鸡模式'}, {'device': '烤箱'}], []]\n",
      "[[{'device': '烤箱'}, {'temperature': '一百八十度'}], []]\n",
      "[[{'address': '主卧'}, {'device': '空调'}, {'operation': '打开'}], []]\n",
      "[[{'device': '空调'}, {'operation': '打开'}], []]\n",
      "[[{'address': '客厅'}, {'device': '空调'}], [{'device': '空调'}, {'operation': '打开'}]]\n",
      "[[{'device': '空调'}, {'operation': '打开'}], []]\n",
      "[[{'address': '客厅'}], [{'device': '空调'}, {'operation': '打开'}]]\n",
      "[[{'device': '空调'}, {'operation': '打开'}], []]\n",
      "[[{'range': '所有'}], [{'device': '空调'}, {'operation': '打开'}]]\n",
      "[[{'range': '所有'}, {'device': '空调'}, {'operation': '打开'}], []]\n",
      "[[{'operation': '打开'}, {'device': '空调'}], []]\n",
      "[[{'device': '空调'}, {'address': '客厅'}], [{'operation': '打开'}, {'device': '空调'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}], []]\n",
      "[[{'address': '客厅'}], [{'operation': '打开'}, {'device': '空调'}]]\n",
      "[[{'address': '客厅'}, {'device': '空调'}, {'operation': '关闭'}], []]\n",
      "[[{'device': '空调'}, {'operation': '关闭'}], []]\n",
      "[[{'address': '客厅'}, {'device': '空调'}], [{'device': '空调'}, {'operation': '关闭'}]]\n",
      "[[{'range': '所有'}, {'device': '空调'}, {'operation': '关闭'}], []]\n",
      "[[{'operation': '关闭'}, {'device': '空调'}], []]\n",
      "[[{'device': '空调'}, {'address': '书房'}], [{'operation': '关闭'}, {'device': '空调'}]]\n",
      "[[{'operation': '关闭'}, {'device': '空调'}], []]\n",
      "[[{'address': '主卧'}], [{'operation': '关闭'}, {'device': '空调'}]]\n",
      "[[{'operation': '关闭'}, {'device': '空调'}], []]\n",
      "[[{'range': '所有'}], [{'operation': '关闭'}, {'device': '空调'}]]\n",
      "[[{'address': '客厅'}, {'device': '空调'}, {'mode': '制热模式'}], []]\n",
      "[[{'mode': '节能模式'}], []]\n",
      "[[{'address': '客厅'}, {'device': '空调'}], [{'mode': '节能模式'}]]\n",
      "[[{'device': '空调'}, {'mode': '节能模式'}], []]\n",
      "[[{'address': '主卧'}, {'device': '空调'}], [{'device': '空调'}, {'mode': '节能模式'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}, {'address': '书房'}], []]\n",
      "[[{'mode': '节能模式'}], [{'operation': '打开'}, {'device': '空调'}, {'address': '书房'}]]\n",
      "[[{'mode': '左右扫风'}], [{'mode': '节能模式'}]]\n",
      "[[{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}, {'address': '主卧'}], []]\n",
      "[[{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}], []]\n",
      "[[{'device': '空调'}, {'address': '主卧'}], [{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}]]\n",
      "[[{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}], []]\n",
      "[[{'address': '主卧'}], [{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}]]\n",
      "[[], []]\n",
      "[[{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}], []]\n",
      "[[{'device': '空调'}, {'address': '主卧'}], [{'time': '一小时'}, {'operation': '关闭'}, {'device': '空调'}]]\n",
      "[[{'time': '五小时'}, {'operation': '关闭'}, {'device': '空调'}], []]\n",
      "[[{'address': '主卧'}], [{'time': '五小时'}, {'operation': '关闭'}, {'device': '空调'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}], []]\n",
      "[[{'address': '主卧'}], [{'operation': '打开'}, {'device': '空调'}]]\n",
      "[[{'time': '一小时'}, {'operation': '关闭'}], [{'address': '主卧'}]]\n",
      "[[{'operation': '增大'}, {'target': '风速'}, {'device': '空调'}, {'address': '客厅'}], []]\n",
      "[[{'sensorvalue': '最大'}, {'target': '风速'}, {'device': '空调'}, {'address': '客厅'}], []]\n",
      "[[{'operation': '调高'}, {'target': '风速'}, {'device': '空调'}], []]\n",
      "[[{'address': '主卧'}], [{'operation': '调高'}, {'target': '风速'}, {'device': '空调'}]]\n",
      "[[{'operation': '调高'}, {'device': '空调'}, {'target': '风速'}], []]\n",
      "[[{'address': '主卧'}], [{'operation': '调高'}, {'device': '空调'}, {'target': '风速'}]]\n",
      "[[{'operation': '调高'}, {'device': '空调'}, {'address': '主卧'}, {'target': '风速'}], []]\n",
      "[[{'operation': '调高'}, {'device': '空调'}, {'target': '风速'}], []]\n",
      "[[{'device': '空调'}, {'address': '主卧'}], [{'operation': '调高'}, {'device': '空调'}, {'target': '风速'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}, {'address': '主卧'}], []]\n",
      "[[{'sensorvalue': '最大'}, {'target': '风速'}], [{'operation': '打开'}, {'device': '空调'}, {'address': '主卧'}]]\n",
      "[[{'sensorvalue': '最小'}, {'target': '风速'}], [{'sensorvalue': '最大'}, {'target': '风速'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}], []]\n",
      "[[{'address': '主卧'}], [{'operation': '打开'}, {'device': '空调'}]]\n",
      "[[{'sensorvalue': '最大'}, {'target': '风速'}], [{'address': '主卧'}]]\n",
      "[[{'sensorvalue': '最小'}, {'target': '风速'}], [{'sensorvalue': '最大'}, {'target': '风速'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}, {'address': '书房'}], []]\n",
      "[[{'device': '空调'}, {'address': '书房'}, {'operation': '增大'}, {'target': '风速'}], [{'operation': '打开'}, {'device': '空调'}, {'address': '书房'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}], []]\n",
      "[[{'address': '书房'}], [{'operation': '打开'}, {'device': '空调'}]]\n",
      "[[{'device': '空调'}, {'address': '书房'}, {'operation': '增大'}, {'target': '风速'}], [{'address': '书房'}]]\n",
      "[[{'device': '空调'}, {'address': '主卧'}, {'operation': '调高到'}, {'temperature': '二十度'}], []]\n",
      "[[{'address': '客厅'}, {'device': '空调'}, {'operation': '调高'}, {'temperature': '一度'}], []]\n",
      "[[{'device': '空调'}, {'address': '主卧'}, {'operation': '打开'}], []]\n",
      "[[{'device': '空调'}, {'operation': '调高到'}, {'temperature': '二十五度'}], [{'device': '空调'}, {'address': '主卧'}, {'operation': '打开'}]]\n",
      "[[{'device': '空调'}, {'operation': '调高'}, {'temperature': '两度'}], [{'device': '空调'}, {'operation': '调高到'}, {'temperature': '二十五度'}]]\n",
      "[[{'operation': '关闭'}, {'device': '空调'}], [{'device': '空调'}, {'operation': '调高'}, {'temperature': '两度'}]]\n",
      "[[{'device': '空调'}, {'operation': '调高到'}, {'temperature': '二十五度'}], []]\n",
      "[[{'device': '空调'}, {'address': '主卧'}], [{'device': '空调'}, {'operation': '调高到'}, {'temperature': '二十五度'}]]\n",
      "[[{'device': '空调'}, {'operation': '调高到'}, {'temperature': '二十五度'}], []]\n",
      "[[{'address': '主卧'}], [{'device': '空调'}, {'operation': '调高到'}, {'temperature': '二十五度'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}], []]\n",
      "[[{'address': '主卧'}, {'device': '空调'}], [{'operation': '打开'}, {'device': '空调'}]]\n",
      "[[{'temperature': '二十五度'}, {'target': '温度'}], [{'address': '主卧'}, {'device': '空调'}]]\n",
      "[[{'operation': '打开'}, {'device': '空调'}], []]\n",
      "[[{'address': '客厅'}], [{'operation': '打开'}, {'device': '空调'}]]\n",
      "[[{'target': '温度'}, {'operation': '调高'}], [{'address': '客厅'}]]\n",
      "[[{'device': '空调'}, {'target': '温度'}, {'operation': '调高'}], []]\n",
      "[[{'address': '主卧'}], [{'device': '空调'}, {'target': '温度'}, {'operation': '调高'}]]\n",
      "[[{'device': '窗帘'}, {'operation': '打开'}], []]\n",
      "[[{'address': '主卧'}], [{'device': '窗帘'}, {'operation': '打开'}]]\n",
      "[[{'device': '窗帘'}, {'operation': '打开'}, {'address': '主卧'}], []]\n",
      "[[{'device': '电饭煲'}, {'operation': '打开'}], []]\n",
      "[[{'mode': '煮饭模式'}], [{'device': '电饭煲'}, {'operation': '打开'}]]\n",
      "[[{'device': '空调'}, {'operation': '打开'}], []]\n",
      "[[{'address': '主卧'}], [{'device': '空调'}, {'operation': '打开'}]]\n",
      "[[{'mode': '制冷模式'}], [{'address': '主卧'}]]\n",
      "[[{'device': '烤箱'}, {'operation': '打开'}], []]\n",
      "[[{'mode': '烤鸡模式'}], [{'device': '烤箱'}, {'operation': '打开'}]]\n",
      "[[{'device': '烤箱'}, {'operation': '调到'}, {'temperature': '两百度'}], [{'mode': '烤鸡模式'}]]\n",
      "[[{'device': '空调'}, {'operation': '打开'}], []]\n",
      "[[{'temperature': '二十九'}, {'device': '空调'}, {'operation': '调到'}], [{'device': '空调'}, {'operation': '打开'}]]\n",
      "[[{'operation': '打开'}, {'device': '风扇'}], []]\n",
      "[[{'mode': '左右摇头'}], [{'operation': '打开'}, {'device': '风扇'}]]\n",
      "[None, []]\n",
      "[None, []]\n",
      "[None, None]\n",
      "[None, []]\n",
      "[None, None]\n",
      "[None, []]\n",
      "[None, []]\n",
      "[None, []]\n",
      "[None, None]\n",
      "[None, []]\n",
      "[None, []]\n",
      "[None, None]\n",
      "[None, []]\n",
      "[None, []]\n",
      "[None, None]\n",
      "[None, []]\n",
      "[None, []]\n",
      "[None, None]\n"
     ]
    }
   ],
   "source": [
    "story_map, story_listmap =  construct_story_map(story)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'storys': [['operation', 'device'], ['Control-RangHood_State']],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'storys': [['operation', 'device', 'mode'], ['Control-RangHood_State']],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'storys': [['device', 'address', 'operation'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_Lamp', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_address', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'device', 'operation'],\n",
       "   ['inform_range', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'device', 'operation'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'address', 'operation'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_Lamp', 'Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'device', 'operation'],\n",
       "   ['inform_range', 'Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'range', 'operation'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'operation', 'device'],\n",
       "   ['inform_range', 'Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['operation', 'device', 'address'], ['Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['sensorvalue', 'device', 'address'], ['Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['operation', 'device', 'address'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['sensorvalue', 'operation', 'device', 'address'],\n",
       "   ['Control-Lamp_Lightness', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['sensorvalue'],\n",
       "   ['Control-Lamp_Lightness', 'Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['device', 'operation'],\n",
       "   ['Control-Lamp_Lightness', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['sensorvalue', 'operation', 'device', 'address'],\n",
       "   ['inform_sensorvalue', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['device', 'address', 'mode'], ['Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['device', 'color', 'address'], ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['device', 'mode', 'address'], ['Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['device', 'address', 'color'], ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['device', 'mode'], ['Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['address', 'device', 'mode'],\n",
       "   ['inform_address', 'Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['device'], ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['address', 'device'], ['inform_address', 'Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['device', 'address', 'target', 'operation', 'color'],\n",
       "   ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['operation', 'target', 'color', 'device', 'address'],\n",
       "   ['Control-Lamp_Color', 'Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['time', 'operation', 'device', 'address'],\n",
       "   ['Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['operation', 'device', 'address', 'time'],\n",
       "   ['Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['time', 'operation', 'device'], ['Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['address', 'time', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['device', 'operation'], ['Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['Control-Fan_State', 'Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['device', 'operation', 'address'], ['Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Fan_Wind']],\n",
       "  'action': ['Control-Fan_Wind']},\n",
       " {'storys': [['sensorvalue', 'device'], ['Control-Fan_Wind']],\n",
       "  'action': ['Control-Fan_Wind']},\n",
       " {'storys': [['sensorvalue', 'device'], ['Control-Fan_Gear']],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'storys': [['operation', 'device'], ['Control-Fan_Gear']],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'storys': [['mode', 'device'], ['Control-Fan_Mode']],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'storys': [['mode', 'device', 'operation'], ['Control-Fan_Mode']],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'storys': [['time', 'operation', 'device'], ['Control-Fan_Timing']],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'storys': [['operation', 'device'], ['Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['time', 'operation', 'device'],\n",
       "   ['Control-Fan_Timing', 'Control-Fan_State']],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'storys': [['operation', 'device'], ['Control-Humidifier_State']],\n",
       "  'action': ['Control-Humidifier_State']},\n",
       " {'storys': [['gear_level', 'device'], ['Control-Humidifier_Gear']],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'storys': [['operation', 'device'], ['Control-Humidifier_Gear']],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'storys': [['device', 'time', 'operation'], ['Control-Humidifier_Timing']],\n",
       "  'action': ['action_humidifiertiming']},\n",
       " {'storys': [['operation', 'device'], ['Control-RiceCooker_State']],\n",
       "  'action': ['Control-RiceCooker_State']},\n",
       " {'storys': [['device', 'mode', 'operation'],\n",
       "   ['Control-RiceCooker_Mode', 'Control-RiceCooker_State']],\n",
       "  'action': ['Control-RiceCooker_Mode']},\n",
       " {'storys': [['device', 'mode'], ['Control-RiceCooker_Mode']],\n",
       "  'action': ['Control-RiceCooker_Mode']},\n",
       " {'storys': [['device', 'time', 'operation'],\n",
       "   ['Control-RiceCooker_Timing', 'Control-RiceCooker_State']],\n",
       "  'action': ['Control-RiceCooker_Timing']},\n",
       " {'storys': [['device', 'operation'], ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'operation', 'sensorvalue'],\n",
       "   ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'operation', 'address'], ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'operation', 'address', 'sensorvalue'],\n",
       "   ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'date_time', 'time', 'operation'],\n",
       "   ['Control-Curtain_Timing']],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'storys': [['device', 'date_time', 'time', 'operation', 'sensorvalue'],\n",
       "   ['Control-Curtain_Timing']],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'storys': [['device', 'operation'], ['Control-Oven_State']],\n",
       "  'action': ['Control-Oven_State']},\n",
       " {'storys': [['mode', 'device'], ['Control-Oven_Mode']],\n",
       "  'action': ['Control-Oven_Mode']},\n",
       " {'storys': [['device', 'temperature'], ['Control-Oven_Temp']],\n",
       "  'action': ['Control-Oven_Temp']},\n",
       " {'storys': [['address', 'device', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_address', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'device', 'operation'],\n",
       "   ['inform_range', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'device', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'device', 'operation'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'operation', 'device'],\n",
       "   ['inform_range', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'mode'], ['Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['mode'], ['Control-AC_Mode']], 'action': ['Control-AC_Mode']},\n",
       " {'storys': [['address', 'device', 'mode'], ['inform_AC', 'Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['device', 'mode'], ['Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['operation', 'device', 'address'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['mode', 'operation', 'device', 'address'],\n",
       "   ['Control-AC_Mode', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['mode'], ['Control-AC_Mode', 'Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['time', 'operation', 'device', 'address'],\n",
       "   ['Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['time', 'operation', 'device'], ['Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['device', 'address', 'time', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['address', 'time', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['PAD'], ['Control-AC_Timing']], 'action': ['Control-AC_Timing']},\n",
       " {'storys': [['time', 'operation', 'device'],\n",
       "   ['Control-AC_Timing', 'Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['time', 'operation', 'address'],\n",
       "   ['Control-AC_Timing', 'inform_address']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['operation', 'target', 'device', 'address'],\n",
       "   ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['sensorvalue', 'target', 'device', 'address'],\n",
       "   ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['operation', 'target', 'device'], ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['address', 'operation', 'target', 'device'],\n",
       "   ['inform_address', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['operation', 'device', 'target'], ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['address', 'operation', 'device', 'target'],\n",
       "   ['inform_address', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['operation', 'device', 'address', 'target'],\n",
       "   ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['device', 'address', 'operation', 'target'],\n",
       "   ['inform_AC', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['sensorvalue', 'target', 'operation', 'device', 'address'],\n",
       "   ['Control-AC_Wind', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['sensorvalue', 'target'],\n",
       "   ['Control-AC_Wind', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['sensorvalue', 'target', 'address'],\n",
       "   ['Control-AC_Wind', 'inform_address']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['device', 'address', 'operation', 'target'],\n",
       "   ['Control-AC_Wind', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['device', 'address', 'operation', 'target'],\n",
       "   ['Control-AC_Wind', 'inform_address']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['device', 'address', 'operation', 'temperature'],\n",
       "   ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'operation', 'temperature'],\n",
       "   ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'address', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation', 'temperature', 'address'],\n",
       "   ['Control-AC_Temp', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'operation', 'temperature'],\n",
       "   ['Control-AC_Temp', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['operation', 'device', 'temperature'],\n",
       "   ['Control-AC_Close', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation', 'temperature'], ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'address', 'operation', 'temperature'],\n",
       "   ['inform_AC', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'operation', 'temperature'],\n",
       "   ['inform_address', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['temperature', 'target', 'address', 'device'],\n",
       "   ['Control-AC_Temp', 'inform_AC']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_AC', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['target', 'operation', 'address'],\n",
       "   ['Control-AC_Temp', 'inform_AC']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'target', 'operation'], ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'target', 'operation'],\n",
       "   ['inform_address', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_address', 'Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-RiceCooker_State']],\n",
       "  'action': ['Control-RiceCooker_State']},\n",
       " {'storys': [['mode', 'device', 'operation'],\n",
       "   ['Control-RiceCooker_Mode', 'Control-RiceCooker_State']],\n",
       "  'action': ['Control-RiceCooker_Mode']},\n",
       " {'storys': [['mode', 'address'], ['inform_mode', 'inform_address']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['mode', 'device', 'operation'],\n",
       "   ['Control-Oven_Mode', 'Control-Oven_State']],\n",
       "  'action': ['Control-Oven_Mode']},\n",
       " {'storys': [['device', 'operation', 'temperature', 'mode'],\n",
       "   ['Control-Oven_Temp', 'Control-Oven_Mode']],\n",
       "  'action': ['Control-Oven_Temp']},\n",
       " {'storys': [['temperature', 'device', 'operation'],\n",
       "   ['Control-AC_Temp', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['mode', 'operation', 'device'],\n",
       "   ['Control-Fan_Mode', 'Control-Fan_State']],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'storys': [['PAD'], ['greet']], 'action': ['utter_answer_greet']},\n",
       " {'storys': [['PAD'], ['affirm', 'greet']], 'action': ['utter_answer_affirm']},\n",
       " {'storys': [['PAD'], ['deny', 'greet']], 'action': ['utter_answer_deny']},\n",
       " {'storys': [['PAD'], ['deny']], 'action': ['utter_answer_deny']},\n",
       " {'storys': [['PAD'], ['goodbye']], 'action': ['utter_answer_goodbye']},\n",
       " {'storys': [['PAD'], ['thanks', 'greet']], 'action': ['utter_answer_thanks']},\n",
       " {'storys': [['PAD'], ['thanks']], 'action': ['utter_answer_thanks']},\n",
       " {'storys': [['PAD'], ['whoareyou', 'greet']],\n",
       "  'action': ['utter_answer_whoareyou']},\n",
       " {'storys': [['PAD'], ['whoareyou']], 'action': ['utter_answer_whoareyou']},\n",
       " {'storys': [['PAD'], ['whattodo']], 'action': ['utter_answer_whattodo']},\n",
       " {'storys': [['PAD'], ['whattodo', 'greet']],\n",
       "  'action': ['utter_answer_whattodo']}]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "story_map"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('../stories/stories_map.json', mode='w', encoding='utf-8') as f:\n",
    "    json.dump(story_map, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('../stories/stories_map.json', mode='r', encoding='utf-8') as f:\n",
    "    stories = json.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'storys': [['operation', 'device'], ['Control-RangHood_State']],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'storys': [['operation', 'device', 'mode'], ['Control-RangHood_State']],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'storys': [['device', 'address', 'operation'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_Lamp', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_address', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'device', 'operation'],\n",
       "   ['inform_range', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'device', 'operation'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'address', 'operation'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_Lamp', 'Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'device', 'operation'],\n",
       "   ['inform_range', 'Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['device', 'range', 'operation'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['range', 'operation', 'device'],\n",
       "   ['inform_range', 'Control-Lamp_Close']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['operation', 'device', 'address'], ['Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['sensorvalue', 'device', 'address'], ['Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['operation', 'device', 'address'], ['Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'storys': [['sensorvalue', 'operation', 'device', 'address'],\n",
       "   ['Control-Lamp_Lightness', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['sensorvalue'],\n",
       "   ['Control-Lamp_Lightness', 'Control-Lamp_Lightness']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['device', 'operation'],\n",
       "   ['Control-Lamp_Lightness', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['sensorvalue', 'operation', 'device', 'address'],\n",
       "   ['inform_sensorvalue', 'Control-Lamp_Open']],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'storys': [['device', 'address', 'mode'], ['Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['device', 'color', 'address'], ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['device', 'mode', 'address'], ['Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['device', 'address', 'color'], ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['device', 'mode'], ['Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['address', 'device', 'mode'],\n",
       "   ['inform_address', 'Control-Lamp_Mode']],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'storys': [['device'], ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['address', 'device'], ['inform_address', 'Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['device', 'address', 'target', 'operation', 'color'],\n",
       "   ['Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['operation', 'target', 'color', 'device', 'address'],\n",
       "   ['Control-Lamp_Color', 'Control-Lamp_Color']],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'storys': [['time', 'operation', 'device', 'address'],\n",
       "   ['Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['operation', 'device', 'address', 'time'],\n",
       "   ['Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['time', 'operation', 'device'], ['Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['address', 'time', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-Lamp_Timing']],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'storys': [['device', 'operation'], ['Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['Control-Fan_State', 'Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['device', 'operation', 'address'], ['Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-Fan_Wind']],\n",
       "  'action': ['Control-Fan_Wind']},\n",
       " {'storys': [['sensorvalue', 'device'], ['Control-Fan_Wind']],\n",
       "  'action': ['Control-Fan_Wind']},\n",
       " {'storys': [['sensorvalue', 'device'], ['Control-Fan_Gear']],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'storys': [['operation', 'device'], ['Control-Fan_Gear']],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'storys': [['mode', 'device'], ['Control-Fan_Mode']],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'storys': [['mode', 'device', 'operation'], ['Control-Fan_Mode']],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'storys': [['time', 'operation', 'device'], ['Control-Fan_Timing']],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'storys': [['operation', 'device'], ['Control-Fan_State']],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'storys': [['time', 'operation', 'device'],\n",
       "   ['Control-Fan_Timing', 'Control-Fan_State']],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'storys': [['operation', 'device'], ['Control-Humidifier_State']],\n",
       "  'action': ['Control-Humidifier_State']},\n",
       " {'storys': [['gear_level', 'device'], ['Control-Humidifier_Gear']],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'storys': [['operation', 'device'], ['Control-Humidifier_Gear']],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'storys': [['device', 'time', 'operation'], ['Control-Humidifier_Timing']],\n",
       "  'action': ['action_humidifiertiming']},\n",
       " {'storys': [['operation', 'device'], ['Control-RiceCooker_State']],\n",
       "  'action': ['Control-RiceCooker_State']},\n",
       " {'storys': [['device', 'mode'], ['Control-RiceCooker_Mode']],\n",
       "  'action': ['Control-RiceCooker_Mode']},\n",
       " {'storys': [['device', 'time'], ['Control-RiceCooker_Timing']],\n",
       "  'action': ['action_RiceCookertiming']},\n",
       " {'storys': [['device', 'operation'], ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'operation', 'sensorvalue'],\n",
       "   ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'operation', 'address'], ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'operation', 'address', 'sensorvalue'],\n",
       "   ['Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'storys': [['device', 'date_time', 'time', 'operation'],\n",
       "   ['Control-Curtain_Timing']],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'storys': [['device', 'date_time', 'time', 'operation', 'sensorvalue'],\n",
       "   ['Control-Curtain_Timing']],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'storys': [['device', 'operation'], ['Control-Oven_State']],\n",
       "  'action': ['Control-Oven_State']},\n",
       " {'storys': [['mode', 'device'], ['Control-Oven_Mode']],\n",
       "  'action': ['Control-Oven_Mode']},\n",
       " {'storys': [['device', 'temperature'], ['Control-Oven_Temp']],\n",
       "  'action': ['Control-Oven_Temp']},\n",
       " {'storys': [['address', 'device', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_address', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'device', 'operation'],\n",
       "   ['inform_range', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'device', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'device', 'operation'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['operation', 'device'], ['Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'address', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['range', 'operation', 'device'],\n",
       "   ['inform_range', 'Control-AC_Close']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['address', 'device', 'mode'], ['Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['mode'], ['Control-AC_Mode']], 'action': ['Control-AC_Mode']},\n",
       " {'storys': [['address', 'device', 'mode'], ['inform_AC', 'Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['device', 'mode'], ['Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['operation', 'device', 'address'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['mode', 'operation', 'device', 'address'],\n",
       "   ['Control-AC_Mode', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['mode'], ['Control-AC_Mode', 'Control-AC_Mode']],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'storys': [['time', 'operation', 'device', 'address'],\n",
       "   ['Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['time', 'operation', 'device'], ['Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['device', 'address', 'time', 'operation'],\n",
       "   ['inform_AC', 'Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['address', 'time', 'operation', 'device'],\n",
       "   ['inform_address', 'Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['PAD'], ['Control-AC_Timing']], 'action': ['Control-AC_Timing']},\n",
       " {'storys': [['time', 'operation', 'device'],\n",
       "   ['Control-AC_Timing', 'Control-AC_Timing']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['time', 'operation', 'address'],\n",
       "   ['Control-AC_Timing', 'inform_address']],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'storys': [['operation', 'target', 'device', 'address'],\n",
       "   ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['sensorvalue', 'target', 'device', 'address'],\n",
       "   ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['operation', 'target', 'device'], ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['address', 'operation', 'target', 'device'],\n",
       "   ['inform_address', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['operation', 'device', 'target'], ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['address', 'operation', 'device', 'target'],\n",
       "   ['inform_address', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['operation', 'device', 'address', 'target'],\n",
       "   ['Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['device', 'address', 'operation', 'target'],\n",
       "   ['inform_AC', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['sensorvalue', 'target', 'operation', 'device', 'address'],\n",
       "   ['Control-AC_Wind', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['sensorvalue', 'target'],\n",
       "   ['Control-AC_Wind', 'Control-AC_Wind']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['device', 'address', 'operation', 'target'],\n",
       "   ['Control-AC_Wind', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Wind']},\n",
       " {'storys': [['device', 'address', 'operation', 'temperature'],\n",
       "   ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'operation', 'temperature'],\n",
       "   ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'address', 'operation'], ['Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation', 'temperature', 'address'],\n",
       "   ['Control-AC_Temp', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'operation', 'temperature'],\n",
       "   ['Control-AC_Temp', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['operation', 'device', 'temperature'],\n",
       "   ['Control-AC_Close', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['device', 'operation', 'temperature'], ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'address', 'operation', 'temperature'],\n",
       "   ['inform_AC', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'operation', 'temperature'],\n",
       "   ['inform_address', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['temperature', 'target', 'address', 'device'],\n",
       "   ['Control-AC_Temp', 'inform_AC']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'operation', 'device'],\n",
       "   ['inform_AC', 'Control-AC_Open']],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'storys': [['target', 'operation', 'address'],\n",
       "   ['Control-AC_Temp', 'inform_AC']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['device', 'target', 'operation'], ['Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'target', 'operation'],\n",
       "   ['inform_address', 'Control-AC_Temp']],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'storys': [['address', 'device', 'operation'],\n",
       "   ['inform_address', 'Control-Curtain_State']],\n",
       "  'action': ['Control-Curtain_State']}]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stories"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[['operation', 'device'], ['Control-RangHood_State']]\n",
      "[['operation', 'device', 'mode'], ['Control-RangHood_State']]\n",
      "[['device', 'address', 'operation'], ['Control-Lamp_Open']]\n",
      "[['device', 'operation'], ['Control-Lamp_Open']]\n",
      "[['device', 'address', 'operation'], ['inform_Lamp', 'Control-Lamp_Open']]\n",
      "[['device', 'operation'], ['Control-Lamp_Open']]\n",
      "[['address', 'device', 'operation'], ['inform_address', 'Control-Lamp_Open']]\n",
      "[['device', 'operation'], ['Control-Lamp_Open']]\n",
      "[['range', 'device', 'operation'], ['inform_range', 'Control-Lamp_Open']]\n",
      "[['range', 'device', 'operation'], ['Control-Lamp_Open']]\n",
      "[['operation', 'device'], ['Control-Lamp_Open']]\n",
      "[['device', 'address', 'operation'], ['inform_Lamp', 'Control-Lamp_Open']]\n",
      "[['operation', 'device'], ['Control-Lamp_Open']]\n",
      "[['address', 'operation', 'device'], ['inform_address', 'Control-Lamp_Open']]\n",
      "[['device', 'address', 'operation'], ['Control-Lamp_Close']]\n",
      "[['device', 'operation'], ['Control-Lamp_Close']]\n",
      "[['device', 'address', 'operation'], ['inform_Lamp', 'Control-Lamp_Close']]\n",
      "[['device', 'operation'], ['Control-Lamp_Close']]\n",
      "[['range', 'device', 'operation'], ['inform_range', 'Control-Lamp_Close']]\n",
      "[['device', 'range', 'operation'], ['Control-Lamp_Close']]\n",
      "[['operation', 'device'], ['Control-Lamp_Close']]\n",
      "[['device', 'address', 'operation'], ['inform_Lamp', 'Control-Lamp_Close']]\n",
      "[['operation', 'device'], ['Control-Lamp_Close']]\n",
      "[['range', 'operation', 'device'], ['inform_range', 'Control-Lamp_Close']]\n",
      "[['operation', 'device'], ['Control-Lamp_Lightness']]\n",
      "[['address', 'operation', 'device'], ['inform_address', 'Control-Lamp_Lightness']]\n",
      "[['operation', 'device'], ['Control-Lamp_Lightness']]\n",
      "[['address', 'operation', 'device'], ['inform_address', 'Control-Lamp_Lightness']]\n",
      "[['operation', 'device'], ['Control-Lamp_Lightness']]\n",
      "[['address', 'operation', 'device'], ['inform_address', 'Control-Lamp_Lightness']]\n",
      "[['operation', 'device', 'address'], ['Control-Lamp_Lightness']]\n",
      "[['sensorvalue', 'device', 'address'], ['Control-Lamp_Lightness']]\n",
      "[['operation', 'device', 'address'], ['Control-Lamp_Open']]\n",
      "[['sensorvalue', 'operation', 'device', 'address'], ['Control-Lamp_Lightness', 'Control-Lamp_Open']]\n",
      "[['sensorvalue'], ['Control-Lamp_Lightness', 'Control-Lamp_Lightness']]\n",
      "[['operation', 'device'], ['Control-Lamp_Open']]\n",
      "[['device', 'operation'], ['Control-Lamp_Lightness', 'Control-Lamp_Open']]\n",
      "[['operation', 'device', 'address'], ['Control-Lamp_Open']]\n",
      "[['sensorvalue', 'operation', 'device', 'address'], ['inform_sensorvalue', 'Control-Lamp_Open']]\n",
      "[['operation', 'device', 'address'], ['Control-Lamp_Open']]\n",
      "[['sensorvalue', 'operation', 'device', 'address'], ['inform_sensorvalue', 'Control-Lamp_Open']]\n",
      "[['operation', 'device', 'address'], ['Control-Lamp_Open']]\n",
      "[['sensorvalue', 'operation', 'device', 'address'], ['Control-Lamp_Lightness', 'Control-Lamp_Open']]\n",
      "[['device', 'address', 'mode'], ['Control-Lamp_Mode']]\n",
      "[['device', 'color', 'address'], ['Control-Lamp_Color']]\n",
      "[['device', 'mode', 'address'], ['Control-Lamp_Mode']]\n",
      "[['device', 'address', 'color'], ['Control-Lamp_Color']]\n",
      "[['device', 'address', 'mode'], ['Control-Lamp_Mode']]\n",
      "[['device', 'address', 'color'], ['Control-Lamp_Color']]\n",
      "[['device', 'mode'], ['Control-Lamp_Mode']]\n",
      "[['address', 'device', 'mode'], ['inform_address', 'Control-Lamp_Mode']]\n",
      "[['device'], ['Control-Lamp_Color']]\n",
      "[['address', 'device'], ['inform_address', 'Control-Lamp_Color']]\n",
      "[['device', 'address', 'target', 'operation', 'color'], ['Control-Lamp_Color']]\n",
      "[['operation', 'target', 'color', 'device', 'address'], ['Control-Lamp_Color', 'Control-Lamp_Color']]\n",
      "[['time', 'operation', 'device', 'address'], ['Control-Lamp_Timing']]\n",
      "[['operation', 'device', 'address', 'time'], ['Control-Lamp_Timing']]\n",
      "[['time', 'operation', 'device'], ['Control-Lamp_Timing']]\n",
      "[['address', 'time', 'operation', 'device'], ['inform_address', 'Control-Lamp_Timing']]\n",
      "[['device', 'operation'], ['Control-Fan_State']]\n",
      "[['address', 'device', 'operation'], ['Control-Fan_State', 'Control-Fan_State']]\n",
      "[['device', 'operation', 'address'], ['Control-Fan_State']]\n",
      "[['device', 'operation'], ['Control-Fan_State']]\n",
      "[['operation', 'device'], ['Control-Fan_Wind']]\n",
      "[['sensorvalue', 'device'], ['Control-Fan_Wind']]\n",
      "[['sensorvalue', 'device'], ['Control-Fan_Wind']]\n",
      "[['sensorvalue', 'device'], ['Control-Fan_Gear']]\n",
      "[['operation', 'device'], ['Control-Fan_Gear']]\n",
      "[['mode', 'device'], ['Control-Fan_Mode']]\n",
      "[['mode', 'device', 'operation'], ['Control-Fan_Mode']]\n",
      "[['time', 'operation', 'device'], ['Control-Fan_Timing']]\n",
      "[['operation', 'device'], ['Control-Fan_State']]\n",
      "[['time', 'operation', 'device'], ['Control-Fan_Timing', 'Control-Fan_State']]\n",
      "[['operation', 'device'], ['Control-Fan_State']]\n",
      "[['time', 'operation', 'device'], ['Control-Fan_Timing', 'Control-Fan_State']]\n",
      "[['operation', 'device'], ['Control-Humidifier_State']]\n",
      "[['gear_level', 'device'], ['Control-Humidifier_Gear']]\n",
      "[['operation', 'device'], ['Control-Humidifier_Gear']]\n",
      "[['device', 'time', 'operation'], ['Control-Humidifier_Timing']]\n",
      "[['operation', 'device'], ['Control-RiceCooker_State']]\n",
      "[['device', 'mode'], ['Control-RiceCooker_Mode']]\n",
      "[['device', 'time'], ['Control-RiceCooker_Timing']]\n",
      "[['device', 'operation'], ['Control-Curtain_State']]\n",
      "[['device', 'operation', 'sensorvalue'], ['Control-Curtain_State']]\n",
      "[['device', 'operation'], ['Control-Curtain_State']]\n",
      "[['device', 'operation', 'sensorvalue'], ['Control-Curtain_State']]\n",
      "[['device', 'date_time', 'time', 'operation'], ['Control-Curtain_Timing']]\n",
      "[['device', 'date_time', 'time', 'operation', 'sensorvalue'], ['Control-Curtain_Timing']]\n",
      "[['device', 'operation'], ['Control-Oven_State']]\n",
      "[['device', 'operation'], ['Control-Oven_State']]\n",
      "[['mode', 'device'], ['Control-Oven_Mode']]\n",
      "[['device', 'temperature'], ['Control-Oven_Temp']]\n",
      "[['address', 'device', 'operation'], ['Control-AC_Open']]\n",
      "[['device', 'operation'], ['Control-AC_Open']]\n",
      "[['address', 'device', 'operation'], ['inform_AC', 'Control-AC_Open']]\n",
      "[['device', 'operation'], ['Control-AC_Open']]\n",
      "[['address', 'device', 'operation'], ['inform_address', 'Control-AC_Open']]\n",
      "[['device', 'operation'], ['Control-AC_Open']]\n",
      "[['range', 'device', 'operation'], ['inform_range', 'Control-AC_Open']]\n",
      "[['range', 'device', 'operation'], ['Control-AC_Open']]\n",
      "[['operation', 'device'], ['Control-AC_Open']]\n",
      "[['device', 'address', 'operation'], ['inform_AC', 'Control-AC_Open']]\n",
      "[['operation', 'device'], ['Control-AC_Open']]\n",
      "[['address', 'operation', 'device'], ['inform_address', 'Control-AC_Open']]\n",
      "[['address', 'device', 'operation'], ['Control-AC_Close']]\n",
      "[['device', 'operation'], ['Control-AC_Close']]\n",
      "[['address', 'device', 'operation'], ['inform_AC', 'Control-AC_Close']]\n",
      "[['range', 'device', 'operation'], ['Control-AC_Close']]\n",
      "[['operation', 'device'], ['Control-AC_Close']]\n",
      "[['device', 'address', 'operation'], ['inform_AC', 'Control-AC_Close']]\n",
      "[['operation', 'device'], ['Control-AC_Close']]\n",
      "[['address', 'operation', 'device'], ['inform_address', 'Control-AC_Close']]\n",
      "[['operation', 'device'], ['Control-AC_Close']]\n",
      "[['range', 'operation', 'device'], ['inform_range', 'Control-AC_Close']]\n",
      "[['address', 'device', 'mode'], ['Control-AC_Mode']]\n",
      "[['mode'], ['Control-AC_Mode']]\n",
      "[['address', 'device', 'mode'], ['inform_AC', 'Control-AC_Mode']]\n",
      "[['device', 'mode'], ['Control-AC_Mode']]\n",
      "[['address', 'device', 'mode'], ['inform_AC', 'Control-AC_Mode']]\n",
      "[['operation', 'device', 'address'], ['Control-AC_Open']]\n",
      "[['mode', 'operation', 'device', 'address'], ['Control-AC_Mode', 'Control-AC_Open']]\n",
      "[['mode'], ['Control-AC_Mode', 'Control-AC_Mode']]\n",
      "[['time', 'operation', 'device', 'address'], ['Control-AC_Timing']]\n",
      "[['time', 'operation', 'device'], ['Control-AC_Timing']]\n",
      "[['device', 'address', 'time', 'operation'], ['inform_AC', 'Control-AC_Timing']]\n",
      "[['time', 'operation', 'device'], ['Control-AC_Timing']]\n",
      "[['address', 'time', 'operation', 'device'], ['inform_address', 'Control-AC_Timing']]\n",
      "[['PAD'], ['Control-AC_Timing']]\n",
      "[['time', 'operation', 'device'], ['Control-AC_Timing', 'Control-AC_Timing']]\n",
      "[['device', 'address', 'time', 'operation'], ['inform_AC', 'Control-AC_Timing']]\n",
      "[['time', 'operation', 'device'], ['Control-AC_Timing']]\n",
      "[['address', 'time', 'operation', 'device'], ['inform_address', 'Control-AC_Timing']]\n",
      "[['operation', 'device'], ['Control-AC_Open']]\n",
      "[['address', 'operation', 'device'], ['inform_address', 'Control-AC_Open']]\n",
      "[['time', 'operation', 'address'], ['Control-AC_Timing', 'inform_address']]\n",
      "[['operation', 'target', 'device', 'address'], ['Control-AC_Wind']]\n",
      "[['sensorvalue', 'target', 'device', 'address'], ['Control-AC_Wind']]\n",
      "[['operation', 'target', 'device'], ['Control-AC_Wind']]\n",
      "[['address', 'operation', 'target', 'device'], ['inform_address', 'Control-AC_Wind']]\n",
      "[['operation', 'device', 'target'], ['Control-AC_Wind']]\n",
      "[['address', 'operation', 'device', 'target'], ['inform_address', 'Control-AC_Wind']]\n",
      "[['operation', 'device', 'address', 'target'], ['Control-AC_Wind']]\n",
      "[['operation', 'device', 'target'], ['Control-AC_Wind']]\n",
      "[['device', 'address', 'operation', 'target'], ['inform_AC', 'Control-AC_Wind']]\n",
      "[['operation', 'device', 'address'], ['Control-AC_Open']]\n",
      "[['sensorvalue', 'target', 'operation', 'device', 'address'], ['Control-AC_Wind', 'Control-AC_Open']]\n",
      "[['sensorvalue', 'target'], ['Control-AC_Wind', 'Control-AC_Wind']]\n",
      "[['operation', 'device', 'address'], ['Control-AC_Open']]\n",
      "[['device', 'address', 'operation', 'target'], ['Control-AC_Wind', 'Control-AC_Open']]\n",
      "[['device', 'address', 'operation', 'temperature'], ['Control-AC_Temp']]\n",
      "[['address', 'device', 'operation', 'temperature'], ['Control-AC_Temp']]\n",
      "[['device', 'address', 'operation'], ['Control-AC_Open']]\n",
      "[['device', 'operation', 'temperature', 'address'], ['Control-AC_Temp', 'Control-AC_Open']]\n",
      "[['device', 'operation', 'temperature'], ['Control-AC_Temp', 'Control-AC_Temp']]\n",
      "[['operation', 'device', 'temperature'], ['Control-AC_Close', 'Control-AC_Temp']]\n",
      "[['device', 'operation', 'temperature'], ['Control-AC_Temp']]\n",
      "[['device', 'address', 'operation', 'temperature'], ['inform_AC', 'Control-AC_Temp']]\n",
      "[['device', 'operation', 'temperature'], ['Control-AC_Temp']]\n",
      "[['address', 'device', 'operation', 'temperature'], ['inform_address', 'Control-AC_Temp']]\n",
      "[['operation', 'device'], ['Control-AC_Open']]\n",
      "[['address', 'operation', 'device'], ['inform_AC', 'Control-AC_Open']]\n",
      "[['temperature', 'target', 'address'], ['Control-AC_Temp', 'inform_AC']]\n",
      "[['operation', 'device'], ['Control-AC_Open']]\n",
      "[['address', 'operation', 'device'], ['inform_AC', 'Control-AC_Open']]\n",
      "[['target', 'operation', 'address'], ['Control-AC_Temp', 'inform_AC']]\n",
      "[['device', 'target', 'operation'], ['Control-AC_Temp']]\n",
      "[['address', 'device', 'target', 'operation'], ['inform_address', 'Control-AC_Temp']]\n"
     ]
    }
   ],
   "source": [
    "for i in stories:\n",
    "    print(i['storys'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
